//
//  NXSharedButton.m
//  Pods
//
//  Created by kepuna on 2017/10/18.
//
//

#import "NXSharedButton.h"

NSString * const NXSharedTypeWechatFriend = @"NXSharedTypeWechatFriend";
NSString * const NXSharedTypeTimeLine = @"NXSharedTypeTimeLine";
NSString * const NXSharedTypeQQ = @"NXSharedTypeQQ";
NSString * const NXSharedTypeWeibo = @"NXSharedTypeWeibo";
NSString * const NXSharedTypeCollection = @"NXSharedTypeCollection";
NSString * const NXSharedTypeCopyright = @"NXSharedTypeCopyright";
NSString * const NXSharedTypeReport = @"NXSharedTypeReport";

@implementation NXSharedButton

+ (instancetype)sharedButton {
    NXSharedButton *button = [[self alloc] initWithFrame:CGRectZero];
    return button;
}

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame]) {
        [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        self.imageView.contentMode = UIViewContentModeScaleAspectFit;
    }
    return self;
}

- (void)setHighlighted:(BOOL)highlighted {}

- (CGRect)imageRectForContentRect:(CGRect)contentRect {
    CGFloat x = contentRect.size.width * 0.2;
    CGFloat y = contentRect.size.height * 0.15;
    CGFloat w = contentRect.size.width - x * 2;
    CGFloat h = contentRect.size.height * 0.5;
    CGRect rect = CGRectMake(x, y, w, h);
    return rect;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect {
    CGRect rect = CGRectMake(0, contentRect.size.height * 0.65, contentRect.size.width, contentRect.size.height * 0.3);
    return rect;
}

@end
